from .champion import Assassin
from typing import Dict, Any, Optional


class JingKe(Assassin):
    """荆轲 - 入场选择目标造成5点伤害"""
    
    def __init__(self):
        super().__init__(
            card_id="jing_ke",
            name="Jing Ke",
            image_path="Jing Ke.jpg",
            description="Assassin: Hidden before first attack.\nOn summon: Deal 5 damage to target enemy hero",
            cost=5,
            attack=4,
            hp=3
        )
    
    def on_summon(self, game_state, player_id: str, effect_target: str = None):
        """入场时对目标造成5点伤害"""
        if not effect_target:
            return
        
        # 查找目标
        target = None
        if effect_target.endswith("_summoner"):
            # 攻击敌方召唤师
            enemy_id = effect_target.split("_summoner")[0]
            target = game_state.get_summoner(enemy_id)
        else:
            # 攻击敌方英雄
            target = game_state.get_champion_by_instance_id(effect_target)
        
        if target and target.is_alive():
            target_dead = target.take_damage(5)
            # 如果目标死亡，从战场移除
            if target_dead:
                game_state._remove_dead_champion(effect_target)


class Dragon(Assassin):
    """龙 - 由刘备死亡时召唤"""
    
    def __init__(self):
        super().__init__(
            card_id="dragon",
            name="Dragon",
            image_path="Dragon.jpg",
            description="Assassin: Hidden before first attack",
            cost=0,
            attack=5,
            hp=5
        )
